﻿/*  
 *  IIS LogFile Analyser, Copyright (C) 2013. http://www.iis-analyser.com
 *  --
 *  This program is free software, provided "AS IS" WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 * 
 *  File Author: Ian Quigley,    2013-02-23
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogParser.DTO;

namespace LogParser.Parsers
{
    internal class CommentSoftwareParser : IParser
    {
        private DocumentHeader _header;
        internal CommentSoftwareParser( DocumentHeader header )
        {
            _header = header;
        }

        int IParser.Priority { get { return 0; } }

        bool IParser.SwitchTo( StringParser parser )
        {
            return !parser.IsEmpty && parser.PeekString( "#Software:", true );
        }

        IDocumentLine IParser.Read( StringParser parser )
        {
            parser.Skip( "#Software:".Length );
            _header.Software = parser.ReadToEndOfLine();
            return new CommentDocument() { Comment = "Software is " + _header.Software };
        }
    }
}
